// Package dto
// @Author: zhangdi
// @File: resp
// @Version: 1.0.0
// @Date: 2023/5/19 10:14
package dto

type RespData struct {
	Code int         `json:"code"`
	Msg  string      `json:"msg"`
	Data interface{} `json:"data"`
}

const CodeOk = 1
const CodeError = 0

func RespOk(msg string, data interface{}) RespData {
	return RespData{
		Code: CodeOk,
		Msg:  msg,
		Data: data,
	}
}

func RespError(msg string) RespData {
	return RespData{
		Code: CodeError,
		Msg:  msg,
		Data: nil,
	}
}
